home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 416 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  64 lines

  1. Newsgroups: comp.lang.c
  2. Path: gail.ripco.com!mambuhl
  3. From: mambuhl@ripco.com (Martin Ambuhl)
  4. Subject: Re: HP UX 10.0 C programm
  5. X-Nntp-Posting-Host: golden.ripco.com
  6. Message-ID: <DKovAp.G37@rci.ripco.com>
  7. Sender: usenet@rci.ripco.com (Net News Admin)
  8. Organization: Ripco Internet BBS Chicago
  9. Date: Fri, 5 Jan 1996 03:35:13 GMT
  10. X-Ident-Sender: mambuhl
  11.  
  12. "Chad R. Laity" <wick@pop.fast.net>
  13. in <4cfje3$qk@nn.fast.net> asks:
  14.  
  15. >2 questions: (1) What is a good book for HP UX 10.0 C programming?
  16.  
  17. Don't know.
  18.  
  19. >             (2) Why do I get an error on this cut down program listed
  20. >                 below when I compile it on an HP 9000 K200 with HP UX 10.0
  21.  
  22. [errors moved to here]
  23. >cc: "test.c", line 15: error 1588: "buf" undefined.
  24. >cc: "test.c", line 15: warning 563: Argument #2 is not the correct type.
  25.  
  26. Because you never defined buf.  You can't expect a more informative
  27. error message than the one you got.
  28.  
  29. Fix it with a declaration
  30.     struct stat buf;
  31.  
  32. BTW, if sys/stat.h contains a prototype for stat(), there's no reason
  33. for you to include one.
  34.  
  35. >                 and I do not get an error with our Intergraph server?
  36.  
  37. If you do not get an error, there are two possibilities:
  38.     1)  This isn't the code being compiled - or -
  39.     2)  The compiler is doing seriously wrong stuff.  If it creates a
  40.     variable "struct stat buf" behind your back, what else might it do?
  41.  
  42. >                 (basically I just want to get the file size of a file but
  43. >                  this buf problem is giving me a head ache)
  44. >----------------------- program ---------------------------------
  45.  
  46. >#include <stdio.h>
  47. >#include <sys/stat.h>
  48.  
  49. >main()
  50. >{
  51. >int i;
  52. >int stat(const char *path, struct stat *buf);
  53.  
  54. >i = stat("/usr2/test/testfile", &buf);           /* line 15 */
  55.  
  56. >}
  57.  
  58. >------------------------ error -----------------------------------
  59. >Compiled using: cc -Aa test.c
  60.                            
  61. --
  62. * Martin Ambuhl       net: mambuhl@ripco.com
  63. * Chicago, IL (USA)    
  64.